package com.kai.steering.data.service.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableId;

import java.io.Serializable;

import com.baomidou.mybatisplus.annotation.TableName;
import com.kai.steering.data.service.entity.domainObject.AnswerDO;
import com.kai.steering.data.service.entity.domainObject.QuestionDO;
import lombok.*;

import java.io.Serializable;

/**
 * <pre>
 * 答案
 * </pre>
 *
 * @author kai
 * @since 2022-02-23
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ToString
@EqualsAndHashCode(callSuper = false)
@TableName(value = "answer")

public class Answer implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 答案id
     */
    @TableId(value = "answer_id", type = IdType.ID_WORKER)

    private String answerId;


    /**
     * 题目id
     */

    private String questionId;


    /**
     * 答案
     */

    private String answer;


    /**
     * 内容
     */

    private String content;


    /**
     * 创建时间
     */

    private Date creationDatetime;


    /**
     * 创建人管理员id或者用户id
     */

    private String founder;


    /**
     * 存在0删除1
     */

    private Integer usable;


    /**
     * 删除日期
     */

    private Date deleteDatetime;



    public Answer(AnswerDO answerDO) {
        convertAnswer(answerDO);
    }

    public Answer convertAnswer(AnswerDO answerDO) {
        this.deleteDatetime = answerDO.getDeleteDatetime();
        this.usable = answerDO.getUsable();
        this.founder = answerDO.getFounder();
        this.creationDatetime = answerDO.getCreationDatetime();
        this.content = answerDO.getContent();
        this.answer = answerDO.getAnswer();
        this.questionId = answerDO.getQuestionId();
        this.answerId = answerDO.getAnswerId();
        return this;
    }
}
